package com.junzhiit.nengji.shop.web.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.bainaeco.framework.util.AssertUtil;
import com.junzhiit.nengji.shop.service.SystemTypeService;
import com.junzhiit.nengji.shop.web.vo.ResultVO;

import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping("/system/type")
public class SystemTypeController extends BaseController {
	
	@Autowired
	private SystemTypeService systemTypeService;
	
	
	
	@ApiOperation(value = "查询所有分类信息,按照等级分好类")
	@RequestMapping(value = "/grading",method = RequestMethod.GET)
	public ResultVO findAllGrading() {
		return systemTypeService.findAllGrading();
	}
	
	@ApiOperation(value="根据系统分类ID查询所有该分类的商品")
	@RequestMapping(value="/goods/{id}",method=RequestMethod.GET)
	public ResultVO getGoodsByType(@PathVariable String id){
		AssertUtil.notBlank(id, "id is required");
		return systemTypeService.getGoodsByType(id);
	}
}
